﻿import flash.geom.Rectangle;
/**
 * ...
 * @author	Kliment
 * @version	1.0.0
 */
class kliment.utils.Translator {
	public static function to(target:Object, from:Object):Void {
		var preffix_target:String = '';
		var preffix_from:String = '';
		
		if (target instanceof MovieClip)
			preffix_target = '_';
			
		if (from instanceof MovieClip)
			preffix_from = '_';
			
		target[preffix_target + 'x'] 		= from[preffix_from + 'x'];
		target[preffix_target + 'y'] 		= from[preffix_from + 'y'];
		target[preffix_target + 'width'] 	= from[preffix_from + 'width'];
		target[preffix_target + 'height'] 	= from[preffix_from + 'height'];
	}
	
	public static function toRectangle(target:Object):Rectangle {
		var preffix_target:String = '';
		if (target instanceof MovieClip)
			preffix_target = '_';
			
		return new Rectangle(target[preffix_target + 'x'], target[preffix_target + 'y'], target[preffix_target + 'width'], target[preffix_target + 'height']);
	}
}